{extend  name="manage@public/layout" /}
{block name="content"}
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>订单列表</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link" onclick="location.replace('/web/order');">
                                <i class="fa fa-refresh"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <form method="post">
                                
                                <div class="col-sm-2 m-b-xs">
                                    <select name="status" class="input-sm input-s-sm form-control inline">
                                        <option selected value="0">支付方式</option>
                                        {volist name="payment" id="vo"}
                                        <option value="{$key}" {notempty name="data['payment']"}{eq name="data['payment']" value="$key"}selected{/eq}{/notempty} >{$vo}</option>
                                        {/volist}
                                    </select>
                                </div>
                                <div class="col-sm-2 col-sm-on">
                                    <select name="notice" class="input-sm input-s-sm form-control inline">
                                        <option selected value="0">通知状态</option>
                                        <option value="1"{notempty name="data['notice']"}{eq name="data['notice']" value="1"}selected{/eq}{/notempty} >已回调</option>
                                        <option value="2"{notempty name="data['notice']"}{eq name="data['notice']" value="2"}selected{/eq}{/notempty} >未回调</option>
                                    </select>
                                </div>
                                <div class="col-sm-2 col-sm-on">
                                    <select name="status" class="input-sm input-s-sm form-control inline">
                                        <option selected value="0">支付方式</option>
                                        <option value="1" {notempty name="data['status']"}{eq name="data['status']" value="1"}selected{/eq}{/notempty} >待支付</option>
                                        <option value="2" {notempty name="data['status']"}{eq name="data['status']" value="2"}selected{/eq}{/notempty} >已支付</option>
                                        <option value="3" {notempty name="data['status']"}{eq name="data['status']" value="3"}selected{/eq}{/notempty} >已关闭</option>
                                    </select>
                                </div>
                                {eq name="auth_mch->is_agent" value="2"}
                                <div class="col-sm-2 col-sm-on">
                                    <input type="text" name="keyword" value="{notempty name="data['keyword']"}{$data['keyword']}{/notempty}" placeholder="商户号/商户订单号" class="input-sm form-control"> 
                                </div>
                                {/eq}
                                <div class="col-sm-auto col-sm-4 col-sm-on">
                                    <input style="width:155px;cursor:not-allowed;" placeholder="开始日期" class="input-sm form-control form-control layer-date" name="start" value="{empty name="data['start']"}<?php echo date('Y-m-d 00:00:00',time());?>{else/}{$data.start}{/empty}" readonly id="start"><i style="position: relative;top:5px;">&nbsp;-&nbsp;</i>
                                    <input style="width:155px;cursor:not-allowed;" placeholder="结束日期" class="input-sm form-control form-control layer-date" name="end" value="{empty name="data['end']"}<?php echo date('Y-m-d H:i:s',time());?>{else/}{$data.end}{/empty}" readonly id="end">
                                </div>
                                <div class="col-sm-1 col-sm-botton">
                                    <div class="input-group">
                                        <button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                                <div class="col-sm-1 col-sm-botton">
                                    <div class="input-group">
                                        <button title="导出" type="submit" name="order_export" value="export" class="btn btn-sm btn-primary"><i class="fa fa-download"></i></button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-bordered">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        {eq name="auth_mch->is_agent" value="2"}
                                        <th>商户号</th>
                                        {/eq}
                                        <th>商户订单号</th>
                                        <th>下单金额</th>
                                        <th>实付金额</th>
                                        <th>支付费率</th>
                                        <th>手续费</th>
                                        <th>商户结算</th>
                                        {eq name="auth_mch->is_agent" value="2"}
                                        <th>代理结算</th>
                                        {/eq}
                                        <th>支付状态</th>
                                        <th>通知状态</th>
                                        <th>支付方式</th>
                                        <th>支付时间</th>
                                        <th>创建时间</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {volist name="list" id="vo"}
                                    <tr>
                                        <td>{$vo.id}</td>
                                        {eq name="auth_mch->is_agent" value="2"}
                                        <td>{$vo.mch_id}</td>
                                        {/eq}
                                        <td>{$vo.out_trade_no}</td>
                                        <td>{$vo.amount|abs}</td>
                                        <th style="color: red;">{$vo.actual_amount|abs|default='--'}</th>
                                        <td>{$vo.run_rate|abs}</td>
                                        <td>{$vo.total_fee|abs}</td>
                                        <td>{eq name="vo.pay_status" value='2'}{$vo.settle|abs|default='--'}{else/}--{/eq}</td>
                                        {eq name="auth_mch->is_agent" value="2"}
                                        <td>{$vo.agent_amount|abs}</td>
                                        {/eq}
                                        <td>
                                            {switch vo.pay_status }
                                            {case 2 }<span style="color: #20c134;">已支付</span>{/case}
                                            {case 3}<span style="color: silver;">已关闭</span>{/case}
                                            {default /}<span style="color: red;">待支付</span>
                                            {/switch}
                                        </td>
                                        <td>
                                          
                                            {eq name="vo.pay_status" value='1'}
                                                <span>---</span>
                                            {else/}
                                                {eq name="vo.notice" value='1'}
                                                    <span style="color: red;">未回调</span>
                                                {else/}
                                                    <span style="color: #20c134;">已回调</span>
                                                {/eq}
                                            {/eq}
                                        </td>
                                        <td>{:\\app\\model\\Channel::paymentType($vo.pay_code)}</td>
                                        <td>{$vo.pay_time|default='---'}</td>
                                        <td>{$vo.create_time}</td>
                                        <td>
                                            <small class="btn btn-sm bt-acc-del btn-white"><i class="fa fa-ban">&nbsp;无可操作</i></small>
                                            <!-- {eq name="vo.pay_status" value="2"}  
                                            <a class="btn btn-white btn-sm" href="" style="color: #1ab394;border: 1px solid #1ab394;"><i class="fa fa-rocket"></i> 补发通知</a>&nbsp;&nbsp;
                                            {/eq} -->
                                        </td>
                                    </tr>
                                    {/volist}
                                </tbody>
                            </table>
                            
                            <div style="float:right;" class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
                                <ul class="pagination">
                                    {$page|raw}
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>   
    {/block}
    {block name="script"}
    <input type='hidden' name="st_start" value="<?php echo date('Y-m-d 00:00:00',strtotime('-7 days'))?>" />
<input type='hidden' name="st_end" value="<?php echo date('Y-m-d 23:59:59',time());?>" />
<script>
    //时间插件
    var start = {
        elem:"#start",
        format:"YYYY-MM-DD hh:mm:ss",
        min:$("input[name='st_start']").val(),
        max:$("input[name='st_end']").val(),
        istime:true,
    };
    var end = {
        elem:"#end",
        format:"YYYY-MM-DD hh:mm:ss",
        min:$("input[name='st_start']").val(),
        max:$("input[name='st_end']").val(),
        istime:true,
    };
    laydate(start);laydate(end);
    
</script>
{/block}
